<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .box{
            position: absolute;
            /* 1. left 走 50% 父容器宽度的一半 */
            left: 50%;
            /* 2.margin 负值 往左边走 自身盒子宽度的一半 */
            margin-left: -100px;
            top: 50%;
            margin-top: -100px;
            width:200px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>